// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Bridge End Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

// Aliases
private alias 46 : TYPE_BRIDGEEND

// Function declarations
reserve function BridgeEnd_DebugDraw
reserve function BridgeEnd_DebugSpawn

// Static Values

// Tables

function BridgeEnd_DebugDraw
	temp0 = object.direction
	temp0 &= 1
	DrawSprite(temp0)
end function


function BridgeEnd_DebugSpawn
	CreateTempObject(TypeName[Bridge End], 0, object.xpos, object.ypos)
	object[tempObjectPos].drawOrder = 4
	object[tempObjectPos].propertyValue = object.direction
	object[tempObjectPos].propertyValue &= 1
end function


event ObjectDraw
	DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
end event


event ObjectStartup
	CheckCurrentStageFolder("WIZ")
	if checkResult == true
		LoadSpriteSheet("WIZ/Objects.gif")
		SpriteFrame(-8, -8, 13, 16, 18, 445)
	else
		LoadSpriteSheet("Blueprint/Objects.gif")
		SpriteFrame(-8, -8, 15, 16, 18, 1)
	end if

	arrayPos0 = 32
	while arrayPos0 < 0x420
		if object[arrayPos0].type == TypeName[Bridge End]
			//object[arrayPos0].drawOrder = 4
		end if
		arrayPos0++
	loop
	SetTableValue(TypeName[Bridge End], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(BridgeEnd_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(BridgeEnd_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
